<!--
 * @Author: WangShuai 1830773767@qq.com
 * @Date: 2025-06-11 14:11:35
 * @LastEditors: WangShuai 1830773767@qq.com
 * @LastEditTime: 2025-06-18 16:03:45
 * @FilePath: \vue3_admin_template\project\src\views\screen\component\Tourist\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="box">
    <div class="top">
      <p class="title">实时游客统计</p>
      <p class="bg"></p>
      <p class="number">
        可预约总量
        <span>99999</span>
        人
      </p>
    </div>
    <div class="pNum">
      <span v-for="(item, index) in people" :key="index">{{ item }}</span>
    </div>
    <!-- 盒子 将来echart 展示图形图表的节点  -->
    <div class="echart" ref="echart"></div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import * as echarts from 'echarts'
import 'echarts-liquidfill' //水球图扩展
let people = ref('215908人')
let echart = ref()
onMounted(() => {
  //获取Echart实例对象
  let myecharts = echarts.init(echart.value)
  //设置实例配置项
  myecharts.setOption({
    title: {
      text: '水球图',
      textStyle: {
        color: '#fff',
      },
    },
    // xAxis: {},
    // yAxis: {},
    series: [
      // 主要水球
      {
        type: 'liquidFill',
        radius: '75%',
        waveAnimation: true,
        animationDuration: 0,
        animationDurationUpdate: 0,
        data: [0.6, 0.5, 0.4, 0.3],
        backgroundStyle: {
          color: '#f0f5ff',
        },
        label: {
          color: '#333',
          normal: {
            textStyle: {
              fontSize: 20,
            },
            formatter: function (param: any) {
              return (param.value * 100).toFixed(0) + '%'
            },
          },
        },
        outline: {
          borderDistance: 9,
          itemStyle: {
            borderWidth: 5,
            borderColor: '#156ACF',
            shadowBlur: 20,
            shadowColor: 'rgba(0, 0, 255, 1)',
          },
        },
      },
    ],
    grid: {
      left: 0,
      right: 0,
      top: 0,
      bottom: 0,
    },
  })
})
</script>

<style lang="scss" scoped>
.box {
  margin: 10px 0 0 0;
  background: url('../../images/dataScreen-main-lb.png') no-repeat;
  background-size: cover;
  .top {
    .title {
      color: #fff;
      font-size: 20px;
      margin-left: 20px;
    }
    .bg {
      width: 68px;
      height: 7px;
      background: url('../../images/dataScreen-title.png') no-repeat;
      background-size: cover;
      margin: 10px 0 0 20px;
    }
    .number {
      float: right;
      color: #fff;
      font-size: 15px;
      span {
        color: yellowgreen;
      }
    }
  }
  .pNum {
    margin: 30px 0 0 0;
    padding: 10px;
    color: #fff;
    font-size: 18px;
    display: flex;
    span {
      flex: 1;
      height: 40px;
      text-align: center;
      line-height: 40px;
      background: url('../../images/total.png') no-repeat;
      background-size: cover;
      color: #29fcff;
    }
  }
  .echart {
    width: 100%;
    height: 240px;
    // background-color: red;
  }
}
</style>
